package wyp.library.ui.fragment;

import android.content.Context;
import android.view.inputmethod.InputMethodManager;

/**
 * Created by wuyiping on 14-4-16.
 */
public abstract class WypFragment extends WypLogFragment {

	protected int getId4Resources(String __idName) {
		String __pkgName = getActivity().getPackageName();
		return getActivity().getResources().getIdentifier(__idName, "id", __pkgName);
	}

	public void hideKeyboard() {
		try {
			InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
			imm.hideSoftInputFromWindow(getView().getWindowToken(), 0); // 强制隐藏键盘
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
